<style src="../../style/statistics.css" scoped></style>

</style>
<template>
    <div class="containerTable">
        <Row class="divSearch">
        <!--搜索框-->
            <Col span="14">
                <label class="searchLabel">所属地区:</label>
                <Select v-model="searchModel.AreaCode"  placeholder="请选择..." style="width:120px" @on-change="GetData()">
                    <Option :value="userInfo.AreaCode">{{(userInfo.AreaCode=='530000000000')?'全省':'全市（州）'}}</Option>
                    <Option :value="item.value" v-for="item in AreaList" :key="item.value">{{item.label}}</Option>
                </Select>                              
                填报年度:
                <Select v-model="searchModel.FillInYear" placeholder="全部" :label-in-value="true" @on-change="GetData()" style="width:120px">
                    <!-- <Option value="">全部</Option> -->
                    <Option :value="item.DictValue" v-for="item in CreateYearList" :key="item.DictValue">{{item.DictText}}</Option>
                </Select> 
            </Col>                   
            <Col span="10" class="searchRight">   
                <Button  type="primary"  @click="Download(userInfo.AreaCode)" class="searchButton">导出列表</Button> 
                <!-- <Button type="success" @click="toAlertCheckResult()" class="searchButton">数据检测</Button>                         -->
                <RadioGroup v-model="currentButton" @on-change="changeButton" type="button">
                    <Radio label="listShow" title="列表">列表<Icon type="ios-paper" size="10"></Icon></Radio>                            
                    <Radio label="barShow" title="饼图">柱状图<Icon type="ios-pie" size="10"></Icon></Radio>
                    <Radio label="mapShow" title="地图">地图<Icon type="android-map" size="10"></Icon></Radio>                            
                </RadioGroup>                    
          </Col>                                
        </Row>           
        <Row  v-show="listShow" class="divStatis">
        <!-- 列表-->
          <div style="overflow-x:scroll">
              <table  class="statisTable">
                <thead>
                  <tr>
                    <th style="width:100px" rowspan="2">地区</th>
                    <th style="width:240px" colspan="4">水果市场（个）</th>
                    <th style="width:360px" colspan="6">水果企业（个）</th>
                    <th style="width:650px" colspan="5">水果农民合作社</th>
                    <th style="width:650px" colspan="5">水果家庭农场</th>
                    <th style="width:990px" colspan="11">相关质量标准认证情况（个）</th>
                    <!-- <th rowspan="2" style="width:100px;" v-show="searchModel.AreaCode=='530000000000'">操作</th> -->
                  </tr>
                  <tr>
                    <th >总数</th>
                    <th >产地性市场</th>
                    <th >专业批发市场</th>
                    <th >区域性综合批发市场</th>
                    <th >总数</th>
                    <th >国家级龙头企业</th>
                    <th >省级龙头企业</th>
                    <th >州（市）级龙头企业</th>
                    <th >县（市、区）级龙头企业</th>
                    <th >其他</th>
                    <th >水果农民合作社数量（个）</th>
                    <th >参加水果农民合作社农户数（户）</th>
                    <th >合作社经营面积（亩）</th>
                    <th >其中：流转土地面积（亩）</th>
                    <th >合作社年销售收入（万元）</th>
                    <th >水果家庭农场数量（个）</th>
                    <th >参加水果家庭农场农户数（户）</th>
                    <th >农场经营面积（亩）</th>
                    <th >其中：流转土地面积（亩）</th>
                    <th >农场年销售收入（万元</th>
                    <th >国家级农业标准化示范县数量</th>
                    <th >出口食品农产品质量安全示范区数量</th>
                    <th >中国驰名商标数</th>
                    <th >中国名牌产品数</th>
                    <th >云南省著名商标数</th>
                    <th >无公害农产品数</th>
                    <th >无公害农产品认证面积（亩）</th>
                    <th >绿色产品数</th>
                    <th >绿色产品认证面积（亩）</th>
                    <th >地理标志证明商标数</th>
                    <th >地理标志产品保护认证数</th>
                  </tr>
                </thead>
                <tbody>
                    <tr v-for="(item,index) in datalist" :key="index" :style="rowStyle(index,datalist.length)">
                              <td style="text-align:center;width:100px;">{{item.AreaName}}</td>                                    
                              <td style="width:60px">{{FormatBigNum(item.MarketNum)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.CdxMarket)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.ZypfMarket)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.QyxzhpfMarket)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.FruCompanyNum)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.ZzNum_country)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.ZzNum_pro)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.ZzNum_city)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.ZzNum_county)}}</td>
                              <td style="width:60px">{{FormatBigNum(item.ZzNum_other)}}</td>
                              <td style="width:130px">{{FormatBigNum(item.HzNum)}}</td>
                              <td style="width:130px">{{FormatBigNum(item.NhhzNum)}}</td>
                              <td style="width:130px">{{(item.NmzyhzNum)?FormatBigNum(item.NmzyhzNum.toFixed(1)):''}}</td>
                              <td style="width:130px">{{(item.HzlzArea)?FormatBigNum(item.HzlzArea.toFixed(1)):''}}</td>
                              <td style="width:130px">{{(item.NmhzYincome)?FormatBigNum(item.NmhzYincome.toFixed(2)):''}}</td>
                              <td style="width:130px">{{FormatBigNum(item.JtncNum)}}</td>
                              <td style="width:130px">{{FormatBigNum(item.JtncnhNum)}}</td>
                              <td style="width:130px">{{(item.JtncjyArea)?FormatBigNum(item.JtncjyArea.toFixed(1)):''}}</td>
                              <td style="width:130px">{{(item.JtnclzArea)?FormatBigNum(item.JtnclzArea.toFixed(1)):''}}</td>
                              <td style="width:130px">{{(item.JtncYincome)?FormatBigNum(item.JtncYincome.toFixed(2)):''}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZlrzNum_sfx)}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZlrzNum_sfq)}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZgcmsbNum)}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZgmpcpNum)}}</td>
                              <td style="width:90px">{{FormatBigNum(item.YnszmsbNum)}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZlrzNum_wghNum)}}</td>
                              <td style="width:90px">{{(item.ZlrzNum_wghmj)?FormatBigNum(item.ZlrzNum_wghmj.toFixed(1)):''}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZlrzNum_bluecp)}}</td>
                              <td style="width:90px">{{(item.ZlrzNum_bluecpmj)?FormatBigNum(item.ZlrzNum_bluecpmj.toFixed(1)):''}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZlrzNum_dlsb)}}</td>
                              <td style="width:90px">{{FormatBigNum(item.ZlrzNum_dlbh)}}</td>  
                              <!-- <td v-show="searchModel.AreaCode=='530000000000'" style="text-align:center">
                            <Button type="primary" size="small" @click="getDetail(item.AreaCode)">详情</Button>
                            <Button type="primary" size="small" @click="Download(item.AreaCode)">导出</Button>
                            </td>                                   -->
                    </tr>
                </tbody>
              </table>                
              <!-- <Row >
                  <Col span="24" class="dataTable">
                      <Page  class="page-style" :total="datas.total" placement="top" show-total show-elevator></Page>
                  </Col>
              </Row> -->
              </div>
        </Row>
         <Row v-show="barShow" class="divStatis">
            <!--饼图-->
            <Tabs type="card">
                <TabPane label="水果市场">
                    <div id="divBarOne" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
                <TabPane label="水果企业">
                    <div id="divBarTwo" style="border:1px solid #D7DDE4;"></div>
                </TabPane>
                <TabPane label="水果农民合作社">
                    <div id="divBarThree" style="border:1px solid #D7DDE4; ">2</div>
                </TabPane>
                <TabPane  label="水果家庭农场">
                    <div id="divBarFour" style="border:1px solid #D7DDE4; ">3</div>
                </TabPane>
                <TabPane label="相关质量标准认证情况">
                    <div id="divBarFive" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
            </Tabs>
        </Row>
        <Row  v-show="mapShow" class="divStatis">
            <!--地图展示-->
            <Tabs type="card">
                <TabPane label="水果市场">
                    <div id="divMapOne" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
                <TabPane label="水果企业">
                    <div id="divMapTwo" style="border:1px solid #D7DDE4;"></div>
                </TabPane>
                <TabPane label="水果农民合作社">
                    <div id="divMapThree" style="border:1px solid #D7DDE4; ">2</div>
                </TabPane>
                <TabPane  label="水果家庭农场">
                    <div id="divMapFour" style="border:1px solid #D7DDE4; ">3</div>
                </TabPane>
                <TabPane label="相关质量标准认证情况">
                    <div id="divMapFive" style="border:1px solid #D7DDE4; ">4</div>
                </TabPane>
            </Tabs>
        </Row>
        <Modal v-model="showType" :mask-closable="false" width="1300">
           <p slot="header" class="title">
              <Icon type="ios-paper" size="20"></Icon>
               <span style="font-size: 20px">详细信息</span>
           </p>
           <p slot="close">
              <Icon type="close-circled" color="red" size=25></Icon>
           </p> 
           <div style="overflow-x:auto;height:650px;">
              <table class="statisTable">
                  <thead>
                    <tr>
                      <th style="width:100px;" rowspan="2">地区</th>
                      <th colspan="4">水果市场（个）</th>
                      <th colspan="6">水果企业（个）</th>
                      <th colspan="4">水果农民合作社</th>
                      <th colspan="4">水果家庭农场</th>
                      <th colspan="11">相关质量标准认证情况（个）</th>                      
                    </tr>
                    <tr>
                      <th >总数</th>
                      <th >产地性市场</th>
                      <th >专业批发市场</th>
                      <th >区域性综合批发市场</th>
                      <th >总数</th>
                      <th >国家级龙头企业</th>
                      <th >省级龙头企业</th>
                      <th >州（市）级龙头企业</th>
                      <th >县（市、区）级龙头企业</th>
                      <th >其他</th>
                      <th >水果农民合作社数量（个）</th>
                      <th >参加水果农民合作社农户数（户）</th>
                      <th >合作社经营面积（其中：流转土地面积）（亩）</th>
                      <th >合作社年销售收入（万元）</th>
                      <th >水果家庭农场数量（个）</th>
                      <th >参加水果家庭农场农户数（户）</th>
                      <th >农场经营面积（其中：流转土地面积）（亩）</th>
                      <th >农场年销售收入（万元）</th>
                      <th >国家级农业标准化示范县数量</th>
                      <th >出口食品农产品质量安全示范区数量</th>
                      <th >中国驰名商标数</th>
                      <th >中国名牌产品数</th>
                      <th >云南省著名商标数</th>
                      <th >无公害农产品数</th>
                      <th >无公害农产品认证面积（亩）</th>
                      <th >绿色产品数</th>
                      <th >绿色产品认证面积（亩）</th>
                      <th >地理标志证明商标数</th>
                      <th >地理标志产品保护认证数</th>
                    </tr>
                  </thead>
                  <tbody>
                      <tr v-for="(item,index) in detailList" :key="index" :style="rowclass(item,index)">
                          <td style="text-align:center">{{item.AreaName}}</td>                                    
                          <td>{{item.MarketNum}}</td>
                          <td>{{item.CdxMarket}}</td>
                          <td>{{item.ZypfMarket}}</td>
                          <td>{{item.QyxzhpfMarket}}</td>
                          <td>{{item.FruCompanyNum}}</td>
                          <td>{{item.ZzNum_country}}</td>
                          <td>{{item.ZzNum_pro}}</td>
                          <td>{{item.ZzNum_city}}</td>
                          <td>{{item.ZzNum_county}}</td>
                          <td>{{item.ZzNum_other}}</td>
                          <td>{{item.HzNum}}</td>
                          <td>{{item.NhhzNum}}</td>
                          <td>{{item.NmzyhzNum}}</td>
                          <td>{{item.NmhzYincome}}</td>
                          <td>{{item.JtncNum}}</td>
                          <td>{{item.JtncnhNum}}</td>
                          <td>{{item.JtncjyArea}}</td>
                          <td>{{item.JtncYincome}}</td>
                          <td>{{item.ZlrzNum_sfx}}</td>
                          <td>{{item.ZlrzNum_sfq}}</td>
                          <td>{{item.ZgcmsbNum}}</td>
                          <td>{{item.ZgmpcpNum}}</td>
                          <td>{{item.YnszmsbNum}}</td>
                          <td>{{item.ZlrzNum_wghNum}}</td>
                          <td>{{item.ZlrzNum_wghmj}}</td>
                          <td>{{item.ZlrzNum_bluecp}}</td>
                          <td>{{item.ZlrzNum_bluecpmj}}</td>
                          <td>{{item.ZlrzNum_dlsb}}</td>
                          <td>{{item.ZlrzNum_dlbh}}</td>                                                                  
                      </tr>
                  </tbody>
                </table>                 
           </div> 
           <p slot="footer">              
           </p>   
        </Modal>
    </div>
</template>
<script>
import echarts from "echarts";
export default {
  data() {
    return {
      pieColStyle: {
        height: window.innerHeight - 190 + "px",
        width: (window.innerWidth - 350) / 2 + "px"
      },
      pieRowStyle: {
        height: window.innerHeight - 190 + "px",
        width: window.innerWidth - 350 + "px"
      },
      showType: false,
      detailList: [], //详情页列表对象
      currentButton: "listShow",
      listShow: true, //列表显示控制器
      barShow: false, //饼图显示控制器
      mapShow: false, //地图显示控制器
      userInfo: this.GetlocaStorage("fruuserinfo"),
      statusList: this.GetGroupDict("ReportStatus"),
      AreaList: this.SearchAreaList(this.GetlocaStorage("fruuserinfo").AreaCode),//所属行政区划数组,
      CreateYearList: this.GetGroupDict("ReportYear"), //周期
      CycleList: this.GetGroupDict("ReportCycle"), //
      datalist: [], //列表对象
      CurrentAreaName:'',
      mapType:'',
      echartsItem0:['水果市场总数','产地批发市场','专业批发市场','区域性综合批发市场'],
      echartsItem1:['水果企业总数','国家级龙头企业','省级龙头企业','州(市)级龙头企业','县(市、区)级龙头企业','其他'],
      echartsItem2:['水果农民合作社数量','参加水果农民合作社农户数','水果农民合作社经营面积','流转土地面积','水果农民合作社年销售收入'],
      echartsItem3:['水果家庭农场数量','参加水果家庭农场农户数','水果家庭农场经营面积','流转土地面积','水果家庭农场年销售收入'],
      echartsItem4:['国家级农业标准化示范县数量','出口食品农产品质量安全示范区数量','中国驰名商标数','中国名牌产品数','云南省著名商标数','无公害农产品数','无公害农产品认证面积','绿色产品数','绿色产品认证面积','地理标志证明商标数','地理标志产品保护认证数'],
      GeoData:'',
      //柱状图数据
      AreaData:[],
      //水果市场
      MarketNumData:[],
      CdxMarketData:[],
      ZypfMarketData:[],
      QyxzhpfMarketData:[],
      //水果企业
      FruCompanyNumData:[],
      ZzNum_CountryData:[],
      ZzNum_ProData:[],
      ZzNum_CityData:[],
      ZzNum_AreaData:[],
      ZzNum_OtherData:[],
      //水果农民合作社
      HzNumData:[],
      NhNumData:[],
      ZyhzNumData:[],
      NmzyhzNumData:[],
      HzlzAreaData:[],//合作流转面积
      NmhzYincomeData:[],//合作社年销售收入（万元）
      //水果家庭农场
      JtncNumData:[],
      JtncnhNumData:[],
      JtncjyAreaData:[],
      JtnclzAreaData:[],
      JtncYincomeData:[],
      //相关质量标准认证情况
      ZlrzNum_SfxData:[],
      ZlrzNum_SfqData:[],
      ZlrzNum_CmsbsData:[],
      ZlrzNum_MpcpData:[],
      ZlrzNum_YnsZmsbData:[],
      ZlrzNum_WghNumData:[],
      ZlrzNum_WghmjData:[],
      ZlrzNum_GreencpData:[],
      ZlrzNum_GreencpmjData:[],
      ZlrzNum_DlsbData:[],
      ZlrzNum_DlbhData:[], 
      barList0:[],
      barList1:[],
      barList2:[],
      barList3:[],
      barList4:[],
      //地图数据
      //水果市场
      MapMarketNumData:[],
      MapCdxMarketData:[],
      MapZypfMarketData:[],
      MapQyxzhpfMarketData:[],
      //水果企业
      MapFruCompanyNumData:[],
      MapZzNum_CountryData:[],
      MapZzNum_ProData:[],
      MapZzNum_CityData:[],
      MapZzNum_AreaData:[],
      MapZzNum_OtherData:[],
      //水果农民合作社
      MapHzNumData:[],
      MapNhNumData:[],
      MapZyhzNumData:[],
      MapNmzyhzNumData:[],
      MapHzlzAreaData:[],//合作流转面积
      MapNmhzYincomeData:[],//合作社年销售收入（万元）
      //水果家庭农场
      MapJtncNumData:[],
      MapJtncnhNumData:[],
      MapJtncjyAreaData:[],
      MapJtnclzAreaData:[],
      MapJtncYincomeData:[],
      //相关质量标准认证情况
      MapZlrzNum_SfxData:[],
      MapZlrzNum_SfqData:[],
      MapZlrzNum_CmsbsData:[],
      MapZlrzNum_MpcpData:[],
      MapZlrzNum_YnsZmsbData:[],
      MapZlrzNum_WghNumData:[],
      MapZlrzNum_WghmjData:[],
      MapZlrzNum_GreencpData:[],
      MapZlrzNum_GreencpmjData:[],
      MapZlrzNum_DlsbData:[],
      MapZlrzNum_DlbhData:[], 
      mapList0:[],
      mapList1:[],
      mapList2:[],
      mapList3:[],
      mapList4:[],

      //查询模型：根据需求删除不不要查询条件
      searchModel: {
        ReportCode: "FruProsecution",
        FillInYear: new Date().getFullYear() + "",
        TimesType: "",
        AreaCode: this.GetlocaStorage("fruuserinfo").AreaCode,
        Status: "",
        PageNumber: 1,
        PageSize: 20
      },
      pageSizeOpts: [20, 40, 50], //默认分页最大设置
      datas: {}, //table数据对象
      dataIds: [],
      ctx: this, //table数据上下文
      columnsList: [],
      tableStyle: {
        height: window.innerHeight - 220 + "px",
        width: 2420 + "px"
      },
      clientHeight: window.innerHeight - 220 //表格默认高度
    };
  },
  mounted() {
    //table高度计算方法
    const that = this;
    window.onresize = () => {
      return (() => {
        that.clientHeight = window.innerHeight - 220;
      })();
    };
  },
  methods: {
    changeButton(n) {
      if (n == "listShow") {
        this.listShow = true; //显示列表
        this.barShow = false;
        this.mapShow = false;
      } else if (n == "barShow") {
        this.listShow = false;
        this.barShow = true; //显示饼图
        this.mapShow = false;
      } else if (n == "mapShow") {
        this.listShow = false;
        this.barShow = false; //显示地图
        this.mapShow = true;
        //  this.getStatsData();   //获取地区统计数据
        //this.showMap();
      } else {
        this.listShow = true; //默认显示列表
        this.barShow = false;
        this.mapShow = false;
      }
    },
    rowStyle(index, length) {
      let striprow = { backgroundColor: "#ebf7ff" };
      if (index == length - 1) {
        return {
          backgroundColor: "#f9c912"
        };
      } else if (index % 2 != 0) {
        return striprow;
      } else {
        return;
      }
    },
    rowclass(item, index) {
      let striprow = {
        backgroundColor: "#ebf7ff"
      };
      let cityrow = {
        backgroundColor: "#f9c912"
      };
      let provinrow = {
        backgroundColor: "#183"
      };
      if (index % 2 == 0) {
        if (item.tag == 1) {
          return cityrow;
        } else if (item.tag == 2) {
          return provinrow;
        }
      } else {
        if (item.tag == 1) {
          return cityrow;
        } else if (item.tag == 2) {
          return provinrow;
        } else {
          return striprow;
        }
      }
    },
    getDetail(AreaCode) {
      var self = this;
      this.$http
        .get("FruProsecution/GetStatisListData", {
          params: {
            AreaCode: AreaCode,
            FillInYear: this.searchModel.FillInYear
          }
        })
        .then(function(res) {
          if (res.data.status == 1) {
            self.detailList = res.data.model;
            self.showType = true;
          } else {
            self.$Modal.error({ title: "提示信息", content: res.data.message });
          }
        });
    },
    Download(AreaCode) {
      window.open(
        this.$http.defaults.baseURL +
          "FruProsecution/GetStatisExcel?FillInYear=" +
          this.searchModel.FillInYear +
          "&&AreaCode=" +
          AreaCode
      );
    },
    GetData() {
      this.getListData();
    },
    getListData() {
      var self = this;
      //判断当前用户是否为省级账号
      if(self.userInfo.AreaCode=="530000000000")
      {
          // self.isProvince=true;
          self.mapType=self.searchModel.AreaCode;
      }
      else{
          self.mapType=self.userInfo.AreaCode;
      }
      //柱状图数据
      self.AreaData=[],
      //水果市场
      self.MarketNumData=[],
      self.CdxMarketData=[],
      self.ZypfMarketData=[],
      self.QyxzhpfMarketData=[],
      //水果企业
      self.FruCompanyNumData=[],
      self.ZzNum_CountryData=[],
      self.ZzNum_ProData=[],
      self.ZzNum_CityData=[],
      self.ZzNum_AreaData=[],
      self.ZzNum_OtherData=[],
      //水果农民合作社
      self.HzNumData=[],
      self.NhNumData=[],
      // self.ZyhzNumData=[],
      self.NmzyhzNumData=[],
      self.HzlzAreaData=[],//合作流转面积
      self.NmhzYincomeData=[],//合作社年销售收入（万元）
      //水果家庭农场
      self.JtncNumData=[],
      self.JtncnhNumData=[],
      self.JtncjyAreaData=[],
      self.JtnclzAreaData=[],
      self.JtncYincomeData=[],
      //相关质量标准认证情况
      self.ZlrzNum_SfxData=[],
      self.ZlrzNum_SfqData=[],
      self.ZlrzNum_CmsbsData=[],
      self.ZlrzNum_MpcpData=[],
      self.ZlrzNum_YnsZmsbData=[],
      self.ZlrzNum_WghNumData=[],
      self.ZlrzNum_WghmjData=[],
      self.ZlrzNum_GreencpData=[],
      self.ZlrzNum_GreencpmjData=[],
      self.ZlrzNum_DlsbData=[],
      self.ZlrzNum_DlbhData=[], 
      self.barList0=[],
      self.barList1=[],
      self.barList2=[],
      self.barList3=[],
      self.barList4=[],
      //地图数据
      //水果市场
      self.MapMarketNumData=[],
      self.MapCdxMarketData=[],
      self.MapZypfMarketData=[],
      self.MapQyxzhpfMarketData=[],
      //水果企业
      self.MapFruCompanyNumData=[],
      self.MapZzNum_CountryData=[],
      self.MapZzNum_ProData=[],
      self.MapZzNum_CityData=[],
      self.MapZzNum_AreaData=[],
      self.MapZzNum_OtherData=[],
      //水果农民合作社
      self.MapHzNumData=[],
      self.MapNhNumData=[],
      // self.MapZyhzNumData=[],
      self.MapNmzyhzNumData=[],
      self.MapHzlzAreaData=[],//合作流转面积
      self.MapNmhzYincomeData=[],//合作社年销售收入（万元）
      //水果家庭农场
      self.MapJtncNumData=[],
      self.MapJtncnhNumData=[],
      self.MapJtncjyAreaData=[],
      self.MapJtnclzAreaData=[],
      self.MapJtncYincomeData=[],
      //相关质量标准认证情况
      self.MapZlrzNum_SfxData=[],
      self.MapZlrzNum_SfqData=[],
      self.MapZlrzNum_CmsbsData=[],
      self.MapZlrzNum_MpcpData=[],
      self.MapZlrzNum_YnsZmsbData=[],
      self.MapZlrzNum_WghNumData=[],
      self.MapZlrzNum_WghmjData=[],
      self.MapZlrzNum_GreencpData=[],
      self.MapZlrzNum_GreencpmjData=[],
      self.MapZlrzNum_DlsbData=[],
      self.MapZlrzNum_DlbhData=[], 
      self.mapList0=[],
      self.mapList1=[],
      self.mapList2=[],
      self.mapList3=[],
      self.mapList4=[];
      self.GeoData=self.GetGeoData(self.mapType); 
      this.$http.get("FruProsecution/GetStatisListData", {params: {AreaCode: this.searchModel.AreaCode,FillInYear: this.searchModel.FillInYear}}).then(function(res) {
          if (res.data.status == 1) {
            self.datalist = res.data.model;
            self.CurrentAreaName=res.data.model[res.data.model.length-1].AreaName=="合计"?'云南省':res.data.model[res.data.model.length-1].AreaName;
            for(var i=0;i<res.data.model.length-1;i++)
            {
              //柱状图数据
              self.AreaData.push(res.data.model[i].AreaName);
              //水果市场
              self.MarketNumData.push(res.data.model[i].MarketNum);
              self.CdxMarketData.push(res.data.model[i].CdxMarket);
              self.ZypfMarketData.push(res.data.model[i].ZypfMarket);
              self.QyxzhpfMarketData.push(res.data.model[i].QyxzhpfMarket);
              //水果企业
              self.FruCompanyNumData.push(res.data.model[i].FruCompanyNum);
              self.ZzNum_CountryData.push(res.data.model[i].ZzNum_country);
              self.ZzNum_ProData.push(res.data.model[i].ZzNum_pro);
              self.ZzNum_CityData.push(res.data.model[i].ZzNum_county);
              self.ZzNum_AreaData.push(res.data.model[i].ZzNum_city);
              self.ZzNum_OtherData.push(res.data.model[i].ZzNum_other);
              //水果农民合作社
              self.HzNumData.push(res.data.model[i].HzNum);
              self.NhNumData.push(res.data.model[i].NhhzNum);
              // self.ZyhzNumData.push(res.data.model[i].ZyhzNum);
              self.NmzyhzNumData.push(res.data.model[i].NmzyhzNum);
              self.HzlzAreaData.push(res.data.model[i].HzlzArea);//合作流转面积
              self.NmhzYincomeData.push(res.data.model[i].NmhzYincome);//合作社年销售收入（万元）
              //水果家庭农场
              self.JtncNumData.push(res.data.model[i].JtncNum);
              self.JtncnhNumData.push(res.data.model[i].JtncnhNum);
              self.JtncjyAreaData.push(res.data.model[i].JtncjyArea);
              self.JtnclzAreaData.push(res.data.model[i].JtnclzArea);
              self.JtncYincomeData.push(res.data.model[i].JtncYincome);
              //相关质量标准认证情况
              self.ZlrzNum_SfxData.push(res.data.model[i].ZlrzNum_sfx);
              self.ZlrzNum_SfqData.push(res.data.model[i].ZlrzNum_sfq);
              self.ZlrzNum_CmsbsData.push(res.data.model[i].ZgcmsbNum);
              self.ZlrzNum_MpcpData.push(res.data.model[i].ZgmpcpNum);
              self.ZlrzNum_YnsZmsbData.push(res.data.model[i].YnszmsbNum);
              self.ZlrzNum_WghNumData.push(res.data.model[i].ZlrzNum_wghNum);
              self.ZlrzNum_WghmjData.push(res.data.model[i].ZlrzNum_wghmj);
              self.ZlrzNum_GreencpData.push(res.data.model[i].ZlrzNum_bluecp);
              self.ZlrzNum_GreencpmjData.push(res.data.model[i].ZlrzNum_bluecpmj);
              self.ZlrzNum_DlsbData.push(res.data.model[i].ZlrzNum_dlsb);
              self.ZlrzNum_DlbhData.push(res.data.model[i].ZlrzNum_dlbh);
              //地图数据
              //水果市场
              self.MapMarketNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].MarketNum});
              self.MapCdxMarketData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].CdxMarket});
              self.MapZypfMarketData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZypfMarket});
              self.MapQyxzhpfMarketData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].QyxzhpfMarket});
              //水果企业
              self.MapFruCompanyNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].FruCompanyNum});
              self.MapZzNum_CountryData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_country});
              self.MapZzNum_ProData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_pro});
              self.MapZzNum_CityData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_county});
              self.MapZzNum_AreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_city});
              self.MapZzNum_OtherData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZzNum_other});
              //水果农民合作社
              self.MapHzNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].HzNum});
              self.MapNhNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].NhhzNum});
              // self.MapZyhzNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZyhzNum});
              self.MapNmzyhzNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].NmzyhzNum});
              self.MapHzlzAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].HzlzArea});//合作流转面积
              self.MapNmhzYincomeData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].NmhzYincome});//合作社年销售收入（万元）
              //水果家庭农场
              self.MapJtncNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JtncNum});
              self.MapJtncnhNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JtncnhNum});
              self.MapJtncjyAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JtncjyArea});
              self.MapJtnclzAreaData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JtnclzArea});
              self.MapJtncYincomeData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].JtncYincome});
              //相关质量标准认证情况
              self.MapZlrzNum_SfxData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_sfx});
              self.MapZlrzNum_SfqData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_sfq});
              self.MapZlrzNum_CmsbsData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZgcmsbNum});
              self.MapZlrzNum_MpcpData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZgmpcpNum});
              self.MapZlrzNum_YnsZmsbData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].YnszmsbNum});
              self.MapZlrzNum_WghNumData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_wghNum});
              self.MapZlrzNum_WghmjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_wghmj});
              self.MapZlrzNum_GreencpData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_bluecp});
              self.MapZlrzNum_GreencpmjData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_bluecpmj});
              self.MapZlrzNum_DlsbData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_dlsb});
              self.MapZlrzNum_DlbhData.push({'name':res.data.model[i].AreaName,'value':res.data.model[i].ZlrzNum_dlbh}); 
            }
            //柱状图数据
            self.barList0.push(self.MarketNumData,self.CdxMarketData,self.ZypfMarketData,self.QyxzhpfMarketData);
            self.barList1.push(self.FruCompanyNumData,self.ZzNum_CountryData,self.ZzNum_ProData,self.ZzNum_CityData,self.ZzNum_AreaData,self.ZzNum_OtherData);
            self.barList2.push(self.HzNumData,self.NhNumData,self.NmzyhzNumData,self.HzlzAreaData,self.NmhzYincomeData);
            self.barList3.push(self.JtncNumData,self.JtncnhNumData,self.JtncjyAreaData,self.JtnclzAreaData,self.JtncYincomeData);
            self.barList4.push(self.ZlrzNum_SfxData,self.ZlrzNum_SfqData,self.ZlrzNum_CmsbsData,self.ZlrzNum_MpcpData,self.ZlrzNum_YnsZmsbData,self.ZlrzNum_WghNumData,self.ZlrzNum_WghmjData,self.ZlrzNum_GreencpData,self.ZlrzNum_GreencpmjData,self.ZlrzNum_DlsbData,self.ZlrzNum_DlbhData);
            //地图数据
            self.mapList0.push(self.MapMarketNumData,self.MapCdxMarketData,self.MapZypfMarketData,self.MapQyxzhpfMarketData);
            self.mapList1.push(self.MapFruCompanyNumData,self.MapZzNum_CountryData,self.MapZzNum_ProData,self.MapZzNum_CityData,self.MapZzNum_AreaData,self.MapZzNum_OtherData);
            self.mapList2.push(self.MapHzNumData,self.MapNhNumData,self.MapNmzyhzNumData,self.MapHzlzAreaData,self.MapNmhzYincomeData);
            self.mapList3.push(self.MapJtncNumData,self.MapJtncnhNumData,self.MapJtncjyAreaData,self.MapJtnclzAreaData,self.MapJtncYincomeData);
            self.mapList4.push(self.MapZlrzNum_SfxData,self.MapZlrzNum_SfqData,self.MapZlrzNum_CmsbsData,self.MapZlrzNum_MpcpData,self.MapZlrzNum_YnsZmsbData,self.MapZlrzNum_WghNumData,self.MapZlrzNum_WghmjData,self.MapZlrzNum_GreencpData,self.MapZlrzNum_GreencpmjData,self.MapZlrzNum_DlsbData,self.MapZlrzNum_DlbhData);
            self.showEcharts();
          } else {
            self.$Modal.error({ title: "提示信息", content: res.data.message });
          }
        });
    },
    showEcharts(){//显示柱状图
    //显示柱状图
    var self=this;
    var containerBarOne=document.getElementById('divBarOne');
    var containerBarTwo=document.getElementById('divBarTwo');
    var containerBarThree=document.getElementById('divBarThree');
    var containerBarFour=document.getElementById('divBarFour');
    var containerBarFive=document.getElementById('divBarFive');
    var containerTable=document.getElementsByClassName('ivu-col ivu-col-span-4');
    // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
    var resizeContainerBar = function () {
        //containerTable[0].clientWidth 左侧菜单栏的宽度
        containerBarOne.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerBarOne.style.height = (window.innerHeight-280)+'px';
        containerBarTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerBarTwo.style.height = (window.innerHeight-280)+'px';
        containerBarThree.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerBarThree.style.height = (window.innerHeight-280)+'px';
        containerBarFour.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerBarFour.style.height = (window.innerHeight-280)+'px';
        containerBarFive.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerBarFive.style.height = (window.innerHeight-280)+'px';
    };
    //设置容器高宽
    resizeContainerBar();
    var myBarOne = myEcharts.init(containerBarOne, 'shine');
    var myBarTwo = myEcharts.init(containerBarTwo, 'shine');
    var myBarThree = myEcharts.init(containerBarThree, 'shine');
    var myBarFour = myEcharts.init(containerBarFour, 'shine');
    var myBarFive = myEcharts.init(containerBarFive, 'shine');
    var BarNameOne=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果市场柱状统计图(全面统计)';
    var BarNameTwo=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果企业柱状统计图(全面统计)';
    var BarNameThree=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果农民合作社柱状统计图(全面统计)';
    var BarNameFour=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果家庭农场柱状统计图(全面统计)';
    var BarNameFive=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'相关质量标准认证情况柱状统计图(全面统计)';
    var optionBarOne = self.GetBarOption(BarNameOne,self.AreaData,self.echartsItem0,self.barList0);
    var optionBarTwo = self.GetBarOption(BarNameTwo,self.AreaData,self.echartsItem1,self.barList1);
    var optionBarThree = self.GetBarOption(BarNameThree,self.AreaData,self.echartsItem2,self.barList2);
    var optionBarFour = self.GetBarOption(BarNameFour,self.AreaData,self.echartsItem3,self.barList3);
    var optionBarFive = self.GetBarOption(BarNameFive,self.AreaData,self.echartsItem4,self.barList4);
    myBarOne.setOption(optionBarOne);
    myBarTwo.setOption(optionBarTwo);
    myBarThree.setOption(optionBarThree);
    myBarFour.setOption(optionBarFour);
    myBarFive.setOption(optionBarFive);
    //******************显示地图
    var self=this;
    var containerMapOne=document.getElementById('divMapOne');
    var containerMapTwo=document.getElementById('divMapTwo');
    var containerMapThree=document.getElementById('divMapThree');
    var containerMapFour=document.getElementById('divMapFour');
    var containerMapFive=document.getElementById('divMapFive');
    // //用于使chart自适应高度和宽度,通过窗体高宽计算容器高宽
    var resizeContainerMap = function () {
        //containerTable[0].clientWidth 左侧菜单栏的宽度
        containerMapOne.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerMapOne.style.height = (window.innerHeight-280)+'px';
        containerMapTwo.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerMapTwo.style.height = (window.innerHeight-280)+'px';
        containerMapThree.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerMapThree.style.height = (window.innerHeight-280)+'px';
        containerMapFour.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerMapFour.style.height = (window.innerHeight-280)+'px';
        containerMapFive.style.width = (window.innerWidth- containerTable[0].clientWidth-22)+'px';
        containerMapFive.style.height = (window.innerHeight-280)+'px';
    };
    //设置容器高宽
    resizeContainerMap();

    var myMapOne = myEcharts.init(containerMapOne, 'shine');
    var myMapTwo = myEcharts.init(containerMapTwo, 'shine');
    var myMapThree = myEcharts.init(containerMapThree, 'shine');
    var myMapFour = myEcharts.init(containerMapFour, 'shine');
    var myMapFive = myEcharts.init(containerMapFive, 'shine');
    var MapNameOne=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果市场统计地区分布图(全面统计)';
    var MapNameTwo=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果企业统计地区分布图(全面统计)';
    var MapNameThree=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果农民合作社统计地区分布图(全面统计)';
    var MapNameFour=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'水果家庭农场统计地区分布图(全面统计)';
    var MapNameFive=this.searchModel.FillInYear+'年(四)'+self.CurrentAreaName+'相关质量标准认证情况统计地区分布图(全面统计)';
    var optionMapOne = self.GetMapOption(MapNameOne,self.GeoData,self.mapType,self.echartsItem0,self.mapList0);
    var optionMapTwo = self.GetMapOption(MapNameTwo,self.GeoData,self.mapType,self.echartsItem1,self.mapList1);
    var optionMapThree = self.GetMapOption(MapNameThree,self.GeoData,self.mapType,self.echartsItem2,self.mapList2);
    var optionMapFour = self.GetMapOption(MapNameFour,self.GeoData,self.mapType,self.echartsItem3,self.mapList3);
    var optionMapFive = self.GetMapOption(MapNameFive,self.GeoData,self.mapType,self.echartsItem4,self.mapList4);
    myMapOne.setOption(optionMapOne);
    myMapTwo.setOption(optionMapTwo);
    myMapThree.setOption(optionMapThree);
    myMapFour.setOption(optionMapFour);
    myMapFive.setOption(optionMapFive);
    //用于使chart自适应高度和宽度
    window.onresize = function () {
        //重置容器高宽
        resizeContainerBar();
        resizeContainerMap();
        myMapOne.resize();
        myMapTwo.resize();
        myMapThree.resize();
        myMapFour.resize();
        myMapFive.resize();
        myBarOne.resize();
        myBarTwo.resize();
        myBarThree.resize();
        myBarFour.resize();
        myBarFive.resize();
    };
},
    checkData() {
      let message = '';
      let isOk = true;
      for (let i = 0; i < this.datalist.length; i++) {
        let Item = this.datalist[i];
        if(Item.MarketNum != Item.CdxMarket * 1 + Item.ZypfMarket * 1 + Item.QyxzhpfMarket * 1){
          isOk = false;
          message += Item.AreaName+ "水果市场个数不等于其子项之和！</br>";
        } 
        if(Item.FruCompanyNum !=Item.ZzNum_country * 1 +Item.ZzNum_pro * 1 +Item.ZzNum_city * 1 +Item.ZzNum_county * 1 +Item.ZzNum_other * 1) {
          isOk = false;
          message += Item.AreaName+"水果企业个数不等于其子项之和！</br>";
        }                
      }
      if(isOk){
        message += "数据检测无误！</br>";
      }
      return message;
    },
    toAlertCheckResult() {
      var message = this.checkData();
      this.$Modal.warning({
        title: "提示信息",
        content: message
      });
    },
    currentYear() {
      let year = new Date().getFullYear();
      let month = new Date().getMonth();
      if (month > 1) {
        this.searchModel.FillInYear = year.toString();
      } else {
        this.searchModel.FillInYear = (year - 1).toString();
      }
    }
  },
  //创建Vue页面方法
  created: function() {
    this.currentYear();
    this.getListData();
  },
  watch: {
    //需要监听的在此处新增监听对象
  }
};
</script>

